package com.defu.newmall.utils;

import com.defu.newmall.entity.*;
import com.defu.newmall.vo.*;

import java.util.ArrayList;
import java.util.List;

public class BeanUtil {
    public static void copyProperties(CarouselEditParam carouselEditParam, Carousel carousel) {
        carousel.setCarouselId(carouselEditParam.getCarouselId());
        carousel.setCarouselUrl(carouselEditParam.getCarouselUrl());
        carousel.setCarouselRank(carouselEditParam.getCarouselRank());
    }

    public static void copyProperties(NewBeeMallOrder newBeeMallOrder, NewBeeMallOrderDetailVO newBeeMallOrderDetailVO) {
        newBeeMallOrderDetailVO.setOrderStatusString(newBeeMallOrder.getOrderStatus().toString());
        newBeeMallOrderDetailVO.setPayTypeString(newBeeMallOrder.getPayType().toString());
        newBeeMallOrderDetailVO.setOrderNo(newBeeMallOrder.getOrderNo());
        newBeeMallOrderDetailVO.setOrderStatus(newBeeMallOrder.getOrderStatus());
        newBeeMallOrderDetailVO.setPayType(newBeeMallOrder.getPayType());
        newBeeMallOrderDetailVO.setTotalPrice(newBeeMallOrder.getTotalPrice());
        newBeeMallOrderDetailVO.setCreateTime(newBeeMallOrder.getCreateTime());
        newBeeMallOrderDetailVO.setPayTime(newBeeMallOrder.getPayTime());


    }

    public static List<NewBeeMallOrderItemVO> copyList(List<NewBeeMallOrderItem> orderItems, Class<NewBeeMallOrderItemVO> newBeeMallOrderItemVOClass) {
        List<NewBeeMallOrderItemVO> vos = new ArrayList<>();
        for (NewBeeMallOrderItem newBeeMallOrderItem : orderItems) {
            NewBeeMallOrderItemVO newBeeMallOrderItemVO = new NewBeeMallOrderItemVO();
            newBeeMallOrderItemVO.setGoodsCount(newBeeMallOrderItem.getGoodsCount());
            newBeeMallOrderItemVO.setGoodsId(newBeeMallOrderItem.getGoodsId());
            newBeeMallOrderItemVO.setGoodsName(newBeeMallOrderItem.getGoodsName());
            newBeeMallOrderItemVO.setSellingPrice(newBeeMallOrderItem.getSellingPrice());
            newBeeMallOrderItemVO.setGoodsCoverImg(newBeeMallOrderItem.getGoodsCoverImg());
            vos.add(newBeeMallOrderItemVO);
        }
        return vos;
    }

    public static void copyProperties(CarouselAddParam carouselAddParam, Carousel carousel) {
        carousel.setCarouselUrl(carouselAddParam.getCarouselUrl());
        carousel.setRedirectUrl(carouselAddParam.getRedirectUrl());
        carousel.setCarouselRank(carouselAddParam.getCarouselRank());

    }

    public static void copyProperties(GoodsCategoryAddParam goodsCategoryAddParam, GoodsCategory goodsCategory) {
        goodsCategory.setCategoryLevel(goodsCategoryAddParam.getCategoryLevel());
        goodsCategory.setParentId(goodsCategoryAddParam.getParentId());
        goodsCategory.setCategoryName(goodsCategoryAddParam.getCategoryName());
        goodsCategory.setCategoryRank(goodsCategoryAddParam.getCategoryRank());
    }

    public static void copyProperties(GoodsCategoryEditParam goodsCategoryEditParam, GoodsCategory goodsCategory) {
        goodsCategory.setCategoryLevel(goodsCategoryEditParam.getCategoryLevel());
        goodsCategory.setParentId(goodsCategoryEditParam.getParentId());
        goodsCategory.setCategoryName(goodsCategoryEditParam.getCategoryName());
        goodsCategory.setCategoryRank(goodsCategoryEditParam.getCategoryRank());

    }

    public static void copyProperties(IndexConfigAddParam indexConfigAddParam, IndexConfig indexConfig) {
        indexConfig.setConfigName(indexConfigAddParam.getConfigName());
        indexConfig.setConfigType(indexConfigAddParam.getConfigType());
        indexConfig.setGoodsId(indexConfigAddParam.getGoodsId());
        indexConfig.setConfigRank(indexConfigAddParam.getConfigRank());

    }

    public static void copyProperties(IndexConfigEditParam indexConfigEditParam, IndexConfig indexConfig) {
        indexConfig.setConfigId(indexConfigEditParam.getConfigId());
        indexConfig.setConfigName(indexConfigEditParam.getConfigName());
        indexConfig.setGoodsId(indexConfigEditParam.getGoodsId());
        indexConfig.setConfigRank(indexConfigEditParam.getConfigRank());

    }

    public static void copyProperties(GoodsAddParam goodsAddParam, NewBeeMallGoods newBeeMallGoods) {
        newBeeMallGoods.setGoodsName(goodsAddParam.getGoodsName());
        newBeeMallGoods.setGoodsIntro(goodsAddParam.getGoodsIntro());
        newBeeMallGoods.setGoodsCategoryId(goodsAddParam.getGoodsCategoryId());
        newBeeMallGoods.setGoodsCoverImg(goodsAddParam.getGoodsCoverImg());
        newBeeMallGoods.setOriginalPrice(goodsAddParam.getOriginalPrice());
        newBeeMallGoods.setSellingPrice(goodsAddParam.getSellingPrice());
        newBeeMallGoods.setStockNum(goodsAddParam.getStockNum());
        newBeeMallGoods.setTag(goodsAddParam.getTag());
        newBeeMallGoods.setGoodsSellStatus(goodsAddParam.getGoodsSellStatus());
        newBeeMallGoods.setGoodsDetailContent(goodsAddParam.getGoodsDetailContent());

    }

    public static void copyProperties(GoodsEditParam goodsEditParam, NewBeeMallGoods newBeeMallGoods) {
        newBeeMallGoods.setGoodsId(goodsEditParam.getGoodsId());
        newBeeMallGoods.setGoodsName(goodsEditParam.getGoodsName());
        newBeeMallGoods.setGoodsIntro(goodsEditParam.getGoodsIntro());
        newBeeMallGoods.setGoodsCategoryId(goodsEditParam.getGoodsCategoryId());
        newBeeMallGoods.setGoodsCoverImg(goodsEditParam.getGoodsCoverImg());
        newBeeMallGoods.setOriginalPrice(goodsEditParam.getOriginalPrice());
        newBeeMallGoods.setSellingPrice(goodsEditParam.getSellingPrice());
        newBeeMallGoods.setStockNum(goodsEditParam.getStockNum());
        newBeeMallGoods.setTag(goodsEditParam.getTag());
        newBeeMallGoods.setGoodsSellStatus(goodsEditParam.getGoodsSellStatus());
        newBeeMallGoods.setGoodsDetailContent(goodsEditParam.getGoodsDetailContent());
    }
}
